{include file="admin@public/header" /}

<body>
    <div class="layui-fluid">
        <div class="layui-card" id="table">
            <div class="layui-card-body">
                <table class="layui-table" id="test" lay-filter="test"></table>
            </div>
        </div>
    </div>
    <script type="text/html" id="optTpl">
    <a class="layui-btn layui-btn-xs" lay-event="views">查看</a>
</script>
    <script type="text/javascript">
        var curr_page = 1;
        //搜索
        function search(curr) {
            //执行重载
            table.reload('test', { page: { curr: curr ? curr : curr_page }, where: {} });
        }

        layui.use(['laydate', 'table'], function () {
            var table = layui.table;

            table.render({
                elem: '#test'
                , url: '/admin/log/lists'
                // ,page: true //开启分页
                , cols: [[ //表头
                    { field: 'name', title: '系统日志' }
                    , { field: 'filemtime', title: '最后更新时间' }
                    , { fixed: 'right', title: '操作', toolbar: '#optTpl', width: 230 }
                ]]
            });

            //监听行工具事件
            table.on('tool(test)', function (obj) {
                var data = obj.data;
                if (obj.event === 'views') {
                    edit("{:url('/admin/log/views/year/" + data.year + "/value/" + data.value + "')}", data.name, '100%');
                }
            });
        });
    </script>
</body>

</html>